package com.enotourister.core.rfp;

import java.util.ArrayList;
import java.util.List;

import com.enotourister.core.model.Tourist;
import com.enotourister.core.param.Parameter;
import com.enotourister.core.provider.Provider;
import com.enotourister.core.provider.ProviderFactory;


public class RequestForProposalManager {
	private RequestForProposal rfp = null;
	
	public RequestForProposalManager(Parameter params, Tourist tourist) {
		rfp = new RegularRequestForProposal(params, tourist);
	}
	
	public void requestForProposals() {
		// Getting possible providers
		List<Provider> providers = getPossibleProviders();

		// Requesting proposals for each available provider
		for (Provider provider : providers) {
			provider.requestProposal(rfp);
		}		
	}
	
	public RequestForProposal getRequestForProposal() {
		return rfp;
	}
	
	protected List<Provider> getPossibleProviders() {
		// Getting possible providers
		List<Provider> providers = new ArrayList<Provider>();
		
		// TODO: Add business logic to instantiate providers
		for (int i=0; i<4; i++) {
			providers.add(ProviderFactory.getProvider());
		}
		
		return providers;
	}
}
